Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import Rust vendoring document #66

Merged
merged 6 commits into from
Oct 8, 2024
Merged

Conversation

slyon
Copy link
Contributor

@slyon slyon commented Sep 3, 2024

Importing the "RustCodeInMain" wiki page and transforming it to Markdown: https://wiki.ubuntu.com/RustCodeInMain

Also updating the README.md file to reference the documentation around the dh-cargo tooling.

Fixes #65

This comment has been minimized.

@slyon
Copy link
Contributor Author

slyon commented Sep 3, 2024

CC @liushuyu @schopin-pro @samkamer -- Please let me know if you're fine with this move of the page.

@schopin-pro
Copy link

Is this documentation rendered anywhere?

@slyon
Copy link
Contributor Author

slyon commented Sep 3, 2024

Is this documentation rendered anywhere?

Only through GitHub, e.g.: https://github.com/slyon/ubuntu-mir/blob/rust-vendoring/vendoring/Rust.md

Copy link
Contributor

@setharnold setharnold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with a quick nit and an open question. Thanks

vendoring/Rust.md Show resolved Hide resolved
vendoring/Rust.md Outdated Show resolved Hide resolved
@jbicha
Copy link
Member

jbicha commented Sep 10, 2024

I believe vendoring directly to vendor/ will cause problems for any packages that are using debian/source/format 3.0 (quilt) where it's not allowed to directly touch things outside of debian/ except via patches or similar.

For gnome-snapshot, I used the Debian Policy § 4.16 convention of using debian/missing-sources\ instead.

So the commands to create and update the vendoring are:

rm -rf debian/missing-sources/
cargo vendor debian/missing-sources
git add -f debian/missing-sources # to avoid missing files because of .gitignore
git commit -m "Vendor Rust crate build dependencies into debian/missing-sources/"

Add a patch like this:

diff --git a/.cargo/config b/.cargo/config
new file mode 100644
index 0000000..8c56c72
--- /dev/null
+++ b/.cargo/config
@@ -0,0 +1,5 @@
+[source.crates-io]
+replace-with = "debian"
+
+[source.debian]
+directory = "debian/missing-sources"

@jbicha

This comment was marked as resolved.

@jbicha

This comment was marked as resolved.

@jbicha

This comment was marked as resolved.

@liushuyu
Copy link

I believe vendoring directly to vendor/ will cause problems for any packages that are using debian/source/format 3.0 (quilt) where it's not allowed to directly touch things outside of debian/ except via patches or similar.

Maybe we can take a page from Node.js, where you can have another source package <name>.orig-vendor.tar.xz. Some other Rust packages are doing this way instead.

@slyon
Copy link
Contributor Author

slyon commented Sep 17, 2024

Maybe we can take a page from Node.js, where you can have another source package <name>.orig-vendor.tar.xz. Some other Rust packages are doing this way instead.

@liushuyu I really like this approach. Could you provide an example of such a Rust package and describe how it's being done?

A similar approach of a vendoring .orig tarball has also been suggested by others in the past, e.g.: https://blog.shadura.me/2020/12/22/vendoring-rust-in-debian-derivative/

This comment has been minimized.

@schopin-pro
Copy link

schopin-pro commented Sep 17, 2024 via email

This comment has been minimized.

This comment has been minimized.

As used by the s390-tools package and suggested by the Rust toolchain team.
check-spelling run (pull_request_target) for rust-vendoring

Signed-off-by: check-spelling-bot <[email protected]>
on-behalf-of: @check-spelling <[email protected]>
@slyon
Copy link
Contributor Author

slyon commented Oct 8, 2024

I've added an example of how s390-tools uses a .orig-vendor.tar.xz approach to isolate the Rust crates in a separate .orig tarball, keeping the gnome-snapshot (using debian/missing-sources) and authd (native + Rust/Golang vendoring) examples around for reference.

This PR should now be ready for merging if others agree!

@cpaelzer cpaelzer merged commit 0c38d9f into canonical:main Oct 8, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document Rust vendoring
6 participants